package team.kirohuji.service.impl.attendance;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import team.kirohuji.domain.attendance.AttendanceRecord;
import team.kirohuji.domain.user.User;
import team.kirohuji.repository.jpa.attendance.AttendanceRecordRepository;
import team.kirohuji.service.attendance.AttendanceRecordService;

@Service("attendanceRecordService")
public class AttendanceRecordServiceImpl implements  AttendanceRecordService {

	@Autowired
	private AttendanceRecordRepository attendanceRepository;

	@Override
	public void punch(User user,Integer status,Integer type,String comment) {
		AttendanceRecord attendanceRecord =new AttendanceRecord();
		attendanceRecord.setCheckDate(new Date());
		attendanceRecord.setComment(comment);
		attendanceRecord.setLocation("none");
		attendanceRecord.setStatus(status);
		attendanceRecord.setType(type);
		attendanceRecord.setUser(user);
		attendanceRepository.save(attendanceRecord);
	}
}
